extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "小尘"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 4.3                 # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 9                    # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 1                 # 魔法攻击（每点代表13.7）
	attCoe.def = 2.5                    # 物理防御（每点代表15）
	attCoe.mgiDef = 2.5               # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "神秘"
	lv = 3
	addSkillTxt("[二刀流]使用夜刃之镰斩击敌方单体2次，每次造成60%神秘系物理伤害，每次提升自身物攻\n物防或闪避10%，最高至60%若目标被<追猎>，则每次吸取目标10%物攻的体力值[CD:8]")
	addSkillTxt("[绝息追猎]<先发>获得20%物攻+20%已损失体力值的护盾，3秒后恢复自身20%已损失的体力值\n敌方全体被<追猎>6秒[CD:15]")
	addSkillTxt("[愈斩愈烈]利用刀锋攻击敌方单体，造成100%神秘系物理伤害，清除目标护盾和自身护盾\n每清除一点则在回合内增加自身2点攻击，若目标被<追猎>，则<破甲>5秒[CD:12]")
	addCdSkill("erdao",8)
	addCdSkill("juexi",15)
	addCdSkill("yuzhan",12)

func _onBattleStart():
	._onBattleStart()
	juexi1()

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "erdao":
		var b:Buff = aiCha.hasBuff("zhuilie")
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("二刀流", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		for i in range(2):
			typeHurtCha(aiCha,att.atk*0.6,Chara.HurtType.PHY,Chara.AtkType.SKILL)
			shuxing()
			if b !=null:
				hurtChara(aiCha,aiCha.att.atk * 0.1,Chara.HurtType.REAL,Chara.AtkType.EFF)
				plusHp(aiCha.att.atk * 0.1)
	if id == "juexi":
		juexi1()
	if id == "yuzhan":
		var b:Buff = aiCha.hasBuff("zhuilie")
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("愈斩愈烈", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		attAdd.atk += (shield+aiCha.shield)*2
		changeShield(-shield)
		aiCha.changeShield(-shield)
		if b != null:
			aiCha.addBuff(bf.pojia.new(5))

func _onBattleEnd():
	._onBattleEnd()
	attAdd.atk = 0

func juexi1():
	var chas = getAllChas(1)
	changeShield(att.atk*0.2+(att.maxHp-att.hp)*0.2)
	for i in chas:
		i.addBuff(bf.zhuilie.new(2))
	yield(reTimer(3),"timeout")
	plusHp((att.maxHp-att.hp)*0.2)


func shuxing():
	var n = sys.rndRan(1,3)
	if n == 1:
		var buff = hasBuff("wugong1")
		if buff == null:
			addBuff(bf.wugong1.new())
		elif buff.att.atkL < 0.6:
			buff.att.atkL += 0.1
	if n == 2:
		var buff = hasBuff("wukang1")
		if buff == null:
			addBuff(bf.wukang1.new())
		elif buff.att.defL < 0.6:
			buff.att.defL += 0.1
	if n == 3:
		var buff = hasBuff("shanbi1")
		if buff == null:
			addBuff(bf.shanbi1.new())
		elif buff.att.dod < 0.6:
			buff.att.dod += 0.1

func _onAtkChara(atkInfo):
	._onAtkChara(atkInfo)
	var b:Buff = aiCha.hasBuff("zhuilie")
	if b !=null:
		atkInfo.hurtVal *= 1.5
